Expected 'With'

You created a With block, but terminated it with the End keyword instead of the End With statement. A With block must be terminated with an associated End With statement. The following demonstrates the correct composition of a With block.

 CopyCode imageCopy Code
      With object
   statements
End With

To correct this error

  • If you ended your With block with an End keyword, change it to the End With statement.

  • Make sure that the With control structure includes all the necessary parts.

See Also